package com.neusoft.neuiotms.micro.databus;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.alibaba.fastjson.JSONObject;
import com.neusoft.bizcore.web.dto.result.PageResultDTO;
import com.neusoft.bizcore.web.dto.result.ResultDTO;
import com.neusoft.bizcore.web.dto.result.ResultListDTO;

import feign.QueryMap;

public interface DatabusMicroService {

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/resources")
    ResultListDTO<JSONObject> getResources(@QueryMap Map<String, Object> queryMap);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/resources/{code}")
    ResultDTO<JSONObject> getSingleResources(@PathVariable String code);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/metrics")
    ResultListDTO<JSONObject> getMetrics();

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/metrics/{code}")
    ResultDTO<JSONObject> getMetricByCode(@PathVariable String code);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/gateways")
    ResultListDTO<HashMap<String, Object>> getGateways();

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/metricgroups")
    ResultListDTO<JSONObject> getMetricGroups();

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/metricgroups/{code}")
    ResultDTO<JSONObject> getMetricInfoByCode(@PathVariable String code);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/monitordatas/p")
    PageResultDTO<HashMap<String, Object>> getMonitorDataPage(Map<String, Object> searchMap);

    @RequestMapping(method = RequestMethod.GET, value = "api/w/monitordatas/range")
    ResultDTO<JSONObject> getMonitorDataRange(Map<String, Object> searchMap);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/metrics/{code}")
    ResultDTO<JSONObject> getSingleMetric(@PathVariable String code);

    @RequestMapping(method = RequestMethod.GET, value = "/api/w/resources/{code}/collect")
    ResultDTO<JSONObject> getCollectMetric(@PathVariable String code);

    @RequestMapping(method = RequestMethod.PUT, value = "/api/w/resources/{code}/control/{metric}", consumes = "application/json")
    ResultDTO<JSONObject> acoustoOpticAlarmControl(@PathVariable String code, @PathVariable String metric);
}
